import {Address} from "src/constants"
import server from '../request'




function fetchHomeData() {
    let uri = Address + 'index/config'
    return server.requestPromise({uri})
}

function fetchPlanDataList(payload) {
    let uri = Address + 'plan?' + server.getParams(payload)
    return server.requestPromise({uri: uri, method: 'GET'})
}
function fetchPlanDatadetail(id,payload) {
    let uri = Address + `${'plan/'+ id + '?'}` + server.getParams(payload)
    return server.requestPromise({uri: uri, method: 'GET'})
}
function fetchCancelPlanList(payload) {
    let uri = Address + 'plan/cancel'
    return server.requestPromise({uri: uri,method:'POST',body: payload})
}

function fetchPlanContinue(payload) {
    let uri = Address + 'plan/continue'
    return server.requestPromise({uri: uri,method:'POST',body: payload})
}

function fetchTeamDirectChild(payload) {
    let uri = Address + 'user/direct/child?' + server.getParams(payload)
    return server.requestPromise({uri: uri, method: 'GET'})
}
function fetchTeamSearchChild(payload) {
    let uri = Address + 'user/search/child?' + server.getParams(payload)
    return server.requestPromise({uri: uri, method: 'GET'})
}

function fetchTeamUserIncome(payload) {
    let uri = Address + 'user/income?' + server.getParams(payload)
    return server.requestPromise({uri: uri, method: 'GET'})
}

function fetchHomeTeamUser(payload) {
    let uri = Address + 'user/team?' + server.getParams(payload)
    return server.requestPromise({uri: uri, method: 'GET'})
}

function fetchUserTeamUser(payload) {
    let uri = Address + 'user/direct/child/info?' + server.getParams(payload)
    return server.requestPromise({uri: uri, method: 'GET'})
}

function fetchWecahtPay(payload) {
    let uri = Address + 'order/upgrade/vip'
    return server.requestPromise({uri: uri, method:'POST',body: payload})
}

function fetchUserHelp(payload) {
    let uri = Address + 'help' + server.getParams(payload)
    return server.requestPromise({uri: uri, method: 'GET'})
}

function fetchDrawMoney(payload) {
    let uri = Address + 'user/cash'
    return server.requestPromise({uri:uri, method:'POST',body: payload})
}

function fetchDrawMoneyList(payload) {
    let uri = Address + 'user/cash/list?' + server.getParams(payload)
    return server.requestPromise({uri:uri, method:'GET'})
}

function fetchUserNotice(payload) {
    let uri = Address + 'user/notice/list?' + server.getParams(payload)
    return server.requestPromise({uri:uri, method:'GET'})
}

function fetchUserCashDetail(payload) {
    let uri = Address + 'user/cash/config?' + server.getParams(payload)
    return server.requestPromise({uri:uri, method:'GET'})
}

module.exports = {
    fetchHomeData: fetchHomeData,
    fetchPlanDataList: fetchPlanDataList,
    fetchPlanDatadetail:fetchPlanDatadetail,
    fetchCancelPlanList:fetchCancelPlanList,
    fetchTeamDirectChild:fetchTeamDirectChild,
    fetchTeamSearchChild:fetchTeamSearchChild,
    fetchTeamUserIncome:fetchTeamUserIncome,
    fetchHomeTeamUser:fetchHomeTeamUser,
    fetchUserTeamUser:fetchUserTeamUser,
    fetchWecahtPay:fetchWecahtPay,
    fetchPlanContinue:fetchPlanContinue,
    fetchUserHelp:fetchUserHelp,
    fetchDrawMoney:fetchDrawMoney,
    fetchDrawMoneyList:fetchDrawMoneyList,
    fetchUserNotice:fetchUserNotice,
    fetchUserCashDetail:fetchUserCashDetail
}
